<template>
  <div 
    v-show="visible" 
    class="fullscreen-loading"
    :style="{ backgroundColor: background }"
  >
    <div class="loading-content">
      <div class="spinner" :style="{ borderTopColor: color }"></div>
      <p v-if="text" class="loading-text" :style="{ color: color }">{{ text }}</p>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Loading',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    text: {
      type: String,
      default: ''
    },
    color: {
      type: String,
      default: '#409EFF'
    },
    background: {
      type: String,
      default: 'rgba(0, 0, 0, 0.6)'
    }
  }
}
</script>

<style scoped>
.fullscreen-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 16px;
  border: 3px solid #f3f3f3;
  border-radius: 50%;
  border-top-color: #409EFF;
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
</style>  